<template>
  <button
    :class="['base-button', { 'is-primary': isPrimary, 'is-disabled': isDisabled }]"
    :disabled="isDisabled"
    @click="handleClick"
  >
    {{ label }}
  </button>
</template>

<script>
import { defineComponent } from 'vue';

export default defineComponent({
  props: {
    label: {
      type: String,
      default: '按钮',
    },
    isPrimary: {
      type: Boolean,
      default: false,
    },
    isDisabled: {
      type: Boolean,
      default: false,
    },
    onClick: {
      type: Function,
      default: () => {},
    },
  },
  setup(props) {
    const handleClick = () => {
      if (!props.isDisabled) {
        props.onClick();
      }
    };

    return {
      handleClick,
    };
  },
});
</script>

<style scoped lang="less">
.base-button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;

  &.is-primary {
    background-color: #007bff;
    color: white;

    &:hover {
      background-color: #0056b3;
    }
  }

  &.is-disabled {
    background-color: #ccc;
    cursor: not-allowed;
  }
}
</style>